home *** CD-ROM | disk | FTP | other *** search
- package
- {
- import com.plus9.mockups.InputManager;
- import com.plus9.mockups.dialogs.BaseDialog;
- import com.plus9.mockups.ui.OKCancel;
- import flash.accessibility.*;
- import flash.data.*;
- import flash.debugger.*;
- import flash.desktop.*;
- import flash.display.*;
- import flash.errors.*;
- import flash.events.*;
- import flash.external.*;
- import flash.filesystem.*;
- import flash.filters.*;
- import flash.geom.*;
- import flash.html.*;
- import flash.html.script.*;
- import flash.media.*;
- import flash.net.*;
- import flash.printing.*;
- import flash.profiler.*;
- import flash.system.*;
- import flash.text.*;
- import flash.ui.*;
- import flash.utils.*;
- import flash.xml.*;
- import mx.binding.*;
- import mx.containers.ControlBar;
- import mx.containers.VBox;
- import mx.controls.Button;
- import mx.controls.Text;
- import mx.core.UIComponentDescriptor;
- import mx.core.mx_internal;
- import mx.events.PropertyChangeEvent;
- import mx.styles.*;
-
- public class UnsavedChangesDialog extends BaseDialog
- {
- public var path:String;
-
- private var _981817656_message:Text;
-
- private var _documentDescriptor_:UIComponentDescriptor;
-
- private var _1541307179_okCancel:OKCancel;
-
- public function UnsavedChangesDialog()
- {
- _documentDescriptor_ = new UIComponentDescriptor({
- "type":BaseDialog,
- "propertiesFactory":function():Object
- {
- return {
- "width":300,
- "height":180,
- "childDescriptors":[new UIComponentDescriptor({
- "type":VBox,
- "stylesFactory":function():void
- {
- this.left = "10";
- this.top = "10";
- this.bottom = "10";
- this.right = "10";
- },
- "propertiesFactory":function():Object
- {
- return {"childDescriptors":[new UIComponentDescriptor({
- "type":Text,
- "id":"_message",
- "propertiesFactory":function():Object
- {
- return {
- "styleName":"boldFont",
- "percentWidth":100,
- "height":40
- };
- }
- }),new UIComponentDescriptor({
- "type":Text,
- "propertiesFactory":function():Object
- {
- return {"text":"Your changes will be lost if you don\'t save them."};
- }
- })]};
- }
- }),new UIComponentDescriptor({
- "type":ControlBar,
- "propertiesFactory":function():Object
- {
- return {"childDescriptors":[new UIComponentDescriptor({
- "type":Button,
- "events":{"click":"___UnsavedChangesDialog_Button1_click"},
- "propertiesFactory":function():Object
- {
- return {"label":"Don\'t Save"};
- }
- }),new UIComponentDescriptor({
- "type":OKCancel,
- "id":"_okCancel",
- "events":{
- "close":"___okCancel_close",
- "cancel":"___okCancel_cancel"
- },
- "stylesFactory":function():void
- {
- this.horizontalAlign = "right";
- },
- "propertiesFactory":function():Object
- {
- return {"percentWidth":100};
- }
- })]};
- }
- })]
- };
- }
- });
- super();
- mx_internal::_document = this;
- this.title = "Unsaved Changes";
- this.width = 300;
- this.height = 180;
- }
-
- [Bindable(event="propertyChange")]
- public function get _okCancel() : OKCancel
- {
- return this._1541307179_okCancel;
- }
-
- protected function onSave(param1:MouseEvent = null) : void
- {
- dispatchEvent(new Event("save"));
- super.onCancel();
- }
-
- public function ___okCancel_cancel(param1:Event) : void
- {
- onCancel();
- }
-
- protected function onDontSave(param1:MouseEvent) : void
- {
- dispatchEvent(new Event("dontsave"));
- super.onCancel();
- }
-
- public function setFileNamePath(param1:String, param2:String) : void
- {
- path = param2;
- if(param1 == "")
- {
- param1 = "New Mockup";
- }
- _message.text = "Do you want to save the changes you made in the document \"" + param1 + "\"?";
- _okCancel.okLabel = param1 == "New Mockup" ? "Save..." : "Save";
- _okCancel.okBtn.setFocus();
- }
-
- [Bindable(event="propertyChange")]
- public function get _message() : Text
- {
- return this._981817656_message;
- }
-
- override public function initialize() : void
- {
- mx_internal::setDocumentDescriptor(_documentDescriptor_);
- super.initialize();
- }
-
- public function set _okCancel(param1:OKCancel) : void
- {
- var _loc2_:Object = this._1541307179_okCancel;
- if(_loc2_ !== param1)
- {
- this._1541307179_okCancel = param1;
- this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_okCancel",_loc2_,param1));
- }
- }
-
- public function set _message(param1:Text) : void
- {
- var _loc2_:Object = this._981817656_message;
- if(_loc2_ !== param1)
- {
- this._981817656_message = param1;
- this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_message",_loc2_,param1));
- }
- }
-
- public function ___okCancel_close(param1:Event) : void
- {
- onSave();
- }
-
- override public function init(param1:InputManager) : void
- {
- super.init(param1);
- defaultButton = _okCancel.okBtn;
- _okCancel.okBtn.setFocus();
- }
-
- public function ___UnsavedChangesDialog_Button1_click(param1:MouseEvent) : void
- {
- onDontSave(param1);
- }
- }
- }
-
-